﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ModernOpenGLSample {
    public partial class SettingsForm : Form {
        public SettingsForm() {
            InitializeComponent();
        }

        private void trackBar2_Scroll(object sender, EventArgs e) {
            label3.Text = (1100 - trackBar2.Value*100).ToString();
            Settings.sensibility = trackBar2.Value * 100;
        }

        private void label3_Click(object sender, EventArgs e) {

        }

        private void SettingsForm_Load(object sender, EventArgs e) {
            trackBar1.Value = (int)(Settings.ssaa * 2);
            trackBar2.Value = (int)(Settings.sensibility / 100);
            trackBar3.Value = (int)(Settings.movement * 10);
            checkBox1.Checked = Settings.PCF == 1 ? true : false;
            checkBox1.Checked = Settings.reverse == -1 ? true : false;
            trackBar1_Scroll(sender, e);
            trackBar2_Scroll(sender, e);
            trackBar3_Scroll(sender, e);

        }

        private void trackBar1_Scroll(object sender, EventArgs e) {
            Settings.ssaa = (float)trackBar1.Value / 2;
            label4.Text = Settings.ssaa.ToString()+"倍";
        }

        private void trackBar3_Scroll(object sender, EventArgs e) {
            Settings.movement = (float)trackBar3.Value / 10;
            label5.Text = Settings.movement.ToString();
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e) {
            Settings.PCF = ((CheckBox)sender).Checked ? 1 : 0;
        }

        private void checkBox2_CheckedChanged(object sender, EventArgs e) {
            Settings.reverse = ((CheckBox)sender).Checked ? -1 : 1;
        }
    }
}
